package com.juyu.miliao.api.dao.mysql;

import com.juyu.miliao.api.domain.User;
import com.juyu.miliao.common.dataSource.tool.distributeOperate.DistributeOperate;
import org.apache.ibatis.session.SqlSession;
import org.springframework.stereotype.Repository;

import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;

/**
 * @author jh
 * 2018/10/9
 */
@Repository
public class MatchHostDao {

    @Resource
    private SqlSession sqlSession;

    @DistributeOperate(ds = "miliao-user")
    public List<String> getMatchHostIcons(Integer max) {
        List<String> result = new ArrayList<>();
        List<User> list = sqlSession.selectList("getMatchHostIcons", max);
        if (!list.isEmpty()) {
            for (User user : list) {
                result.add(user.getIcon());
            }
        }

        return result;
    }


}
